<?php
// 本类由系统自动生成，仅供测试用途
namespace Home\Controller;
class IndexController extends CommonController {

	/**
    * 全局初始化
    * @return
    */
    public function _initialize() {
        // utf-8编码
        header('Content-Type: text/html; charset=utf-8');
    	$Model = M('base');
    	$data['base'] = $Model->where('status=1')->find();
    	$data['goods'] = $this->get_goods();
        $data['news'] = $this->get_news();
        $this->assign('action_name',ACTION_NAME);
		$this->assign('data', $data);
    }

    public function get_goods($id=null){
    	$Model = M('goods');
    	$where = "1";
    	if ($id) {
    		$where .= " and id=".$id; 
    	}
    	$goods = $Model->where($where)->select();
        // var_dump($data);die;
    	return $goods;
    }

    public function get_news($id=null){
        $Model = M('news');
        $where = "1";
        if ($id) {
            $where .= " and id=".$id; 
        }
        $news = $Model->where($where)->select();
        // var_dump($data);die;
        return $news;
    }

    public function index(){
		$this->display();
    }

    public function about(){
        $this->display();
    }

    public function product(){
        $this->display();
    }

    public function news(){
        $this->display();
    }

    public function connection(){
        $this->display();
    }
}

